package com.leetcode.array_matrix;

/**
 * @author Dennis Li
 * @date 2020/8/11 11:15
 */
public class RemoveDuplicates_26 {

    public int removeDuplicates(int[] nums) {
        int j = 0;
        for (int i = 0; i < nums.length - 1; i++) {
            if (nums[i + 1] != nums[i])
                nums[j++] = nums[i + 1];
        }
        return j + 1;
    }

}
